package com.felix.algorithms.planning;

/**
 * RangeSumQuery
 *
 * @author xuejinhua
 * @date 2018/9/11 13:47
 */
public class RangeSumQuery {
    public static int[] nums = {-2, 0, 3, -5, 2, -1};

    public static int sumRange(int i, int j) {
        int sum = 0;
        for (; i < j + 1; i++) {
            sum += nums[i];
        }
        return sum;
    }

    public static void main(String[] args) {
        System.out.println(sumRange(0,2));
    }
}
